package auth

import (
	"context"

	"gitee.com/liuxuezhan/ar-platform/admin-api/internal/svc"
	"gitee.com/liuxuezhan/ar-platform/admin-api/internal/types"
	UserAuthClient "gitee.com/liuxuezhan/ar-platform/rpc-client/userAuthClient/client/auth"

	"github.com/zeromicro/go-zero/core/logx"
)

type DeleteLogic struct {
	logx.Logger
	ctx    context.Context
	svcCtx *svc.ServiceContext
}

// 用户实名认证-删除
func NewDeleteLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DeleteLogic {
	return &DeleteLogic{
		Logger: logx.WithContext(ctx),
		ctx:    ctx,
		svcCtx: svcCtx,
	}
}

func (l *DeleteLogic) Delete(req *types.UserAuthDeleteRequest) (resp *types.UserAuthDeleteResponse, err error) {
	_, err = l.svcCtx.UserAuth.Delete(l.ctx, &UserAuthClient.DeleteReq{
		UserId: req.Id,
	})
	if err != nil {
		return nil, err
	}
	return &types.UserAuthDeleteResponse{}, nil
}
